package com.bosssoft.hr.jobmonitor.service.impl;

import com.bosssoft.hr.jobmonitor.core.Timer.CheckFileTaskTool;
import com.bosssoft.hr.jobmonitor.core.Timer.CheckFileTaskTool;
import com.bosssoft.hr.jobmonitor.entity.User;
import com.bosssoft.hr.jobmonitor.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/***
 * @Author lys(cherish)
 * @Description 用户服务xml实现
 * @Date  2019/2/26
 **/
@Service
public class XmlUserServiceImpl implements IUserService {

    //检查文件任务工具
    @Autowired
    private CheckFileTaskTool checkFileTaskTool;

    /***
     * @Author lys(cherish)
     * @Description 查询所有用户
     * @Date  2019/2/26
     * @Param []
     * @return java.util.List<com.bosssoft.hr.jobmonitor.entity.User>
     **/
    @Override
    public List<User> queryAllUser() {
        List<User> users = checkFileTaskTool.queryAllUser();
        return users;
    }

    /***
     * @Author lys(cherish)
     * @Description 根据用户ID查询用户
     * @Date  2019/2/26
     * @Param [id]
     * @return com.bosssoft.hr.jobmonitor.entity.User
     **/
    @Override
    public User getUserById(Integer id) {
        List<User> allUser = queryAllUser();
        for (User u:allUser) {
            if(u.getId().intValue()==id.intValue()){
                return u;
            }
        }
        return null;
    }

    /***
     * @Author lys(cherish)
     * @Description 保存用户
     * @Date  2019/2/26
     * @Param [user]
     * @return void
     **/
    @Override
    public void saveUser(User user) {
    }

    /***
     * @Author lys(cherish)
     * @Description 根据用户ID删除用户
     * @Date  2019/2/26
     * @Param [id]
     * @return com.bosssoft.hr.jobmonitor.entity.User
     **/
    @Override
    public User deleteUserById(Integer id) {
        return null;
    }
}
